home *** CD-ROM | disk | FTP | other *** search
/ Champak 125 / Vol 125 (Damaged).iso / games / rabbit_r.swf / scripts / __Packages / disney / rabbitRivalry / ui / Screen.as < prev    next >
Encoding:
Text File  |  2009-06-09  |  2.4 KB  |  112 lines

  1. class disney.rabbitRivalry.ui.Screen
  2. {
  3.    var __mc;
  4.    var ui;
  5.    var __outroCallbackID;
  6.    var __outroCallbackPath;
  7.    var __isOpening;
  8.    var __isClosing;
  9.    var __isClosed;
  10.    var __INTRO_FRAME = "intro";
  11.    var __OUTRO_FRAME = "outro";
  12.    var __HAS_INTRO = false;
  13.    var __HAS_OUTRO = false;
  14.    var __OPENED_FRAME = 10;
  15.    var DOES_UPDATE = true;
  16.    function Screen(mc, t_ui)
  17.    {
  18.       this.__mc = mc;
  19.       this.ui = t_ui;
  20.       this.__outroCallbackID = this.__outroCallbackPath = "";
  21.    }
  22.    function update(dt)
  23.    {
  24.       if(this.__isOpening)
  25.       {
  26.          if(this.__mc._currentFrame >= this.__OPENED_FRAME)
  27.          {
  28.             this.onOpened();
  29.          }
  30.       }
  31.       else if(this.__isClosing)
  32.       {
  33.          if(this.__mc._currentFrame == this.__mc._totalFrames)
  34.          {
  35.             this.onClosed();
  36.          }
  37.       }
  38.    }
  39.    function init()
  40.    {
  41.       this.__isOpening = this.__isClosing = false;
  42.       this.__isClosed = true;
  43.    }
  44.    function open()
  45.    {
  46.       this.__isClosed = false;
  47.       if(this.__HAS_INTRO)
  48.       {
  49.          this.__isOpening = true;
  50.          this.__mc.gotoAndPlay(this.__INTRO_FRAME);
  51.       }
  52.       else
  53.       {
  54.          this.onOpened();
  55.       }
  56.    }
  57.    function onOpened()
  58.    {
  59.       this.__isOpening = false;
  60.       this.__mc.gotoAndStop(this.__OPENED_FRAME);
  61.    }
  62.    function close()
  63.    {
  64.       if(this.__isClosed)
  65.       {
  66.          this.ui.onScreenClosed();
  67.          return undefined;
  68.       }
  69.       if(this.__HAS_OUTRO)
  70.       {
  71.          this.__isClosing = true;
  72.          this.__mc.gotoAndPlay(this.__OUTRO_FRAME);
  73.       }
  74.       else
  75.       {
  76.          this.onClosed();
  77.       }
  78.    }
  79.    function onClosed()
  80.    {
  81.       this.__isClosing = false;
  82.       this.__isClosed = true;
  83.       if(this.__outroCallbackID != "")
  84.       {
  85.          smashing.keithm.Messenger.sendMessage(this.__outroCallbackPath,this.__outroCallbackID);
  86.          this.__outroCallbackID = this.__outroCallbackPath = "";
  87.       }
  88.       else
  89.       {
  90.          this.ui.onScreenClosed();
  91.       }
  92.    }
  93.    function closeThenCallback(callbackPath, callbackID)
  94.    {
  95.       this.__outroCallbackPath = callbackPath;
  96.       this.__outroCallbackID = callbackID;
  97.       this.close();
  98.    }
  99.    function makeButton(mc)
  100.    {
  101.       mc.screen = this;
  102.    }
  103.    function onMessageReceived(message, args)
  104.    {
  105.       this[message](args);
  106.    }
  107.    function toString()
  108.    {
  109.       return "Screen";
  110.    }
  111. }
  112.